// utils/date.js
export function toLocalDateTimeString(date) {
    return new Date(date).toISOString().slice(0, 19)
}

export function parseLocalDateTime(str) {
    return new Date(str + 'Z') // 添加Z表示UTC
}

export function formatToLocalDateTime(date) {
    const d = new Date(date)
    return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
}

function pad(num) { return num.toString().padStart(2, '0') }

